﻿@model DTcms.Model.user_message
@{
    ViewBag.Title = "";
}
@section HeaderContent{
    <script type="text/javascript" charset="utf-8" src="~/scripts/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="~/scripts/ueditor/ueditor.all.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="~/scripts/ueditor/lang/zh-cn/zh-cn.js"></script>
}
<form id="form1" class="layui-form" url="MessageSave?action=@ViewBag.action&id=@ViewBag.id">
    @Html.AntiForgeryToken()
    <!--导航栏-->
    <div class="pageheader">
        <div class="page-bar">
            <ul class="page-breadcrumb">
                <li><a href="../users/message_list" class="back"><i class="fa fa-mail-reply-all"></i> 返回列表页</a></li>
                <li><a href="javascript:;"><i class="iconfont icon-home1"></i> 首页</a> </li>
                <li><a href="javascript:;">站内消息</a> </li>
                <li><a href="javascript:;">编辑短消息</a> </li>
            </ul>
        </div>
    </div>
    <!--/导航栏-->

    <!--内容-->
    <div class="layui-fluid">
        <div class="layui-tab layui-tab-card">
            <ul class="layui-tab-title" id="floatHead">
                <li class="layui-this">编辑消息内容</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    @if (ViewBag.View)
                    {
                        <div class="layui-form-item">
                            <label class="layui-form-label">短信类型：</label>
                            <div class="layui-input-block">
                                @switch (Model.type)
                                {
                                    case 1:
                                        @:系统消息
                                        break;
                                    case 2:
                                        @:收件箱
                                        break;
                                    case 3:
                                        @:发件箱
                                        break;
                                }
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">发件人：</label>
                            <div class="layui-input-block">
                                @(string.IsNullOrEmpty(Model.post_user_name) ? "-" : Model.post_user_name)
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">收件人：</label>
                            <div class="layui-input-block">@Model.accept_user_name</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">发送时间：</label>
                            <div class="layui-input-block">@Model.post_time</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">阅读状态：</label>
                            <div class="layui-input-block">
                                @(Model.is_read == 1 ? "已阅读" : "未阅读")
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">阅读时间：</label>
                            <div class="layui-input-block">
                                @(Model.read_time != null ? Model.read_time.ToString() : "-")
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">标题：</label>
                            <div class="layui-input-block">@Model.title</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">内容：</label>
                            <div class="layui-input-block">@Html.Raw(Model.content)</div>
                        </div>
                    }
                    @if (ViewBag.Add)
                    {
                        <div class="layui-form-item">
                            <label class="layui-form-label">收件人</label>
                            <div class="layui-input-block">
                                @Html.TextBox("accept_user_name", "", new { @class = "input normal", datatype = "*", sucmsg = " " })
                                <span class="Validform_checktip">*输入用户名，以英文逗号“,”分隔开</span>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">标题</label>
                            <div class="layui-input-block">
                                @Html.TextBox("title", Model.title, new { @class = "input normal", datatype = "*1-100", sucmsg = " " })
                                <span class="Validform_checktip">*100个字符以内</span>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">短信内容</label>
                            <div class="layui-input-block">
                                @Html.TextArea("content", Model.content, new { @style = "height:300px; width:100%;" })
                            </div>
                        </div>
                    }
                </div>
            </div>
        </div>
    </div>
    <!--/内容-->
    <!--工具栏-->
    <div class="page-footer">
        <div class="btn-wrap">
            @if (ViewBag.Add)
            {
                <button class="layui-btn icon-btn" id="btnSubmit"><i class="layui-icon layui-icon-ok"></i>提交保存</button>
            }
            <button class="layui-btn layui-btn-warm icon-btn" name="btnReturn" onclick="javascript:history.back(-1);"><i class="layui-icon layui-icon-return"></i>返回上一页</button>
        </div>
    </div>
    <!--/工具栏-->
</form>
@section Scripts{
    <script type="text/javascript">
        layui.use(['jqueryform', 'validform', 'element'], function () {
            //初始化表单验证
            $("#form1").initValidform('#btnSubmit', 1);

            //初始化编辑器
            var ue = UE.getEditor('content', {
                serverUrl: '/upload_ajax/action',
                toolbars: [[
                    'fullscreen', 'source', '|', 'undo', 'redo', '|',
                    'bold', 'italic', 'underline', 'strikethrough', 'removeformat', 'pasteplain', '|', 'forecolor', 'insertorderedlist', 'insertunorderedlist', '|',
                    'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
                    'link', 'unlink', 'anchor', '|',
                    'simpleupload', 'insertimage', 'scrawl', 'insertvideo', 'music', 'attachment'
                ]]
            });
        });
    </script>
}